
#ifndef  CANIF_H_
#define  CANIF_H_


#include "include.h"


#define CAN_RX_FIFOLength    (u8)(10u)
#define CAN_TX_FIFOLength    (u8)(200u)


typedef struct
{
	u8 u8Rx_Ide;
	u8 u8Rx_Dlc;
  u8 u8Rx_Data[8];
	u32 u32Rx_MsgId;
}Can_Rx_MsgType;

typedef enum
{
	Msg_ControlSignal=0,
	Msg_MaxSignal,
}Msg_SignalType;

typedef struct
{
	u16 u16SignalFlag;
	u32 u32SignalValue[Msg_MaxSignal];
	u32 u32TimeStampCnt[Msg_MaxSignal];
}Msg_InfoType;

typedef enum
{
	BUSOFF_NormalRunning = 0,
	BUSOFF_FastBUSOFF,
	BUSOFF_Recovery,
	BUSOFF_SlowBUSOFF,
}CAN_BUSOFFStatusType;

typedef struct
{
	u8 u8AllowTranSmitFlag;
	u8 u8Busoff_ResetCnt;
	u8 u8LastTranSmitFlag;
	u16 u16Busoff_ResetTime;
	u32 u32Busoff_ResetTimeStamp;
	CAN_BUSOFFStatusType  CAN_BUSOFFStatus;
}CAN_BUSOFFInfoType;

extern void Can_BusoffTimeCnt(void);
extern void CANIF_MainFunction(void);
#endif
